
#include <mockcpp/mockcpp.hpp>
#include <testngpp/testngpp.hpp>
#include <Rectangle.h>

USING_MOCKCPP_NS
USING_TESTNGPP_NS

FIXTURE(Rectangle)
{
        TEST(should be able to calculate area : area(2.34, 3.45))
        {
                Rectangle rectangle(2.34, 3.45);
                ASSERT_EQ(1, (rectangle.getArea () - 8.07) < 0.01);
        } 

        TEST(should be able to calculate perimeter : perimeter(2.34, 3.45))
        {
                Rectangle rectangle(2.34, 3.45);
                ASSERT_EQ(1, (rectangle.getPerimeter () - 11.58) < 0.01);
        }

        TEST(should be able to change width: setWdith (20))
        {
                Rectangle rectangle(2, 3);
                ASSERT_EQ(true, rectangle.setWidth(20));
        }

        TEST(should be able to change Height: setHeight (30))
        {
                Rectangle rectangle(2, 3);
                ASSERT_EQ(true, rectangle.setHeight(30));
        }  

        TEST(should be able to limit valid width: setWdith (101.00))
        {
                Rectangle rectangle(2, 3);
                ASSERT_EQ(false, rectangle.setWidth(101.00));
                ASSERT_EQ(false, rectangle.setWidth(0.00));
        }       
        
        TEST(should be able to limit valid Height: setHeight (101.00))
        {
                Rectangle rectangle(2, 3);
                ASSERT_EQ(false, rectangle.setHeight(101.00));
                ASSERT_EQ(false, rectangle.setHeight(0.00));
        }
};
